﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Webapi.EFCore.Model;

namespace Webapi.EFCore.IRepository
{
    /// <summary>
    /// 工作单元()-接口
    /// </summary>
    [Service]
    public interface IUnitOfWork
    {
        /// <summary>
        /// 获取上下文
        /// </summary>
        /// <returns></returns>
        DbContext GetDbContext();

        /// <summary>
        /// 异步提交数据库服务器
        /// </summary>
        /// <returns></returns>
        Task<int> SaveChangesAsync();
    }
}
